<!-- 分类头部组件 -->
<template>
  <div class="category-header">
    <header>
      <a href="javascript:;" onclick="window.history.back()" class="iconfont icon-jiantou3"></a>
      <form action>
        <input type="text" placeholder="搜索关键字" />
        <i class="iconfont icon-sousuo2"></i>
      </form>
      <a
        href="javascript:;"
        :class="flag?'iconfont  icon-tubiao13':'iconfont icon-leimupinleifenleileibie'"
        @click="changeList"
      ></a>
    </header>
  </div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';

export default {
  //import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    //这里存放数据
    return {
      flag: false,
    };
  },
  //监听属性 类似于data概念
  computed: {},
  //监控data中的数据变化
  watch: {},
  //方法集合
  methods: {
    changeList() {
      this.$emit("changeListStyle", (this.flag = !this.flag));
    },
  },
};
</script>
<style lang="less">
.category-header {
  width: 100%;
  height: 4.4rem;
  background: #fff;

  header {
    display: flex;
    height: 4.4rem;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ccc;
    box-sizing: border-box;
    a {
      width: 4.4rem;
      height: 4.4rem;
      display: block;
      text-align: center;
      line-height: 4.4rem;
    }
    form {
      width: 100%;
      width: calc(100% - 8.8rem);
      position: relative;
      input {
        width: 100%;
        height: 3rem;
        border-radius: 1.5rem;
        font-size: 1.4rem;
        text-align: center;
        background: #efefef;
      }
      i {
        position: absolute;
        width: 3rem;
        height: 3rem;
        right: 0;
        top: 0;
        text-align: center;
        line-height: 3rem;
      }
    }
  }
}
</style>